const path = require('node:path')
const fs = require('node:fs/promises')
const express = require('express')
const {HttpStatusCode} = require("axios");


const app = express()

// 静态资源目录
app.use(express.static(path.resolve(__dirname, 'public')))

app.use((req, res, next) =>  {
  next()
})

app.get('/ping', (req, res) => {
  res.json({
    code: HttpStatusCode.Ok,
    message: "Ok",
    data: 'pong'
  })
})

const port = 3000
const hostname = 'localhost'
app.listen(port, hostname, () => {
  console.log(`listen on: ${hostname}:${port}`)
})